<?php
$newMsgs = $this->module->getNewMsgs();
$action = $this->getAction()->getId();

if ($this->module->authManager) {
    $authNew = Yii::app()->user->checkAccess("Mailbox.Message.New");
    $authInbox = Yii::app()->user->checkAccess("Mailbox.Message.Inbox");
    $authSent = Yii::app()->user->checkAccess("Mailbox.Message.Sent");
    $authTrash = Yii::app()->user->checkAccess("Mailbox.Message.Trash");
} else {
    $authNew = $this->module->sendMsgs && (!$this->module->readOnly || $this->module->isAdmin());
    $authInbox = (!$this->module->readOnly || $this->module->isAdmin() );
    $authTrash = $this->module->trashbox && (!$this->module->readOnly || $this->module->isAdmin());
    $authSent = $this->module->sentbox && (!$this->module->readOnly || $this->module->isAdmin());
}
?>
<div class="navbar">
    <div class="navbar-inner">
	<ul class="nav">
	    <?php
	    if ($authNew) :
		//<div class="mailbox-menu-newmsg  ui-helper-clearfix" align="center">
		?>

		<?php /* <span><a class="btn btn-danger create-msg" href="<?php echo $this->createUrl('message/new'); ?>">New Message</a></span> */ ?>
    	    <li <?php if (Yii::app()->controller->action->id == "new") echo 'class="active"'; ?>><a href="<?php echo $this->createUrl('message/new'); ?>">New Message</a></span></li>

		<?php
	    //</div>
	    endif;
	    //<div class="mailbox-menu-folders ui-helper-clearfix">
	    ?>

	    <?php if ($authInbox): ?>
    	    <li <?php if (Yii::app()->controller->action->id == "inbox") echo 'class="active"'; ?>>
		    <?php /*
		      <div id="mailbox-inbox" class="mailbox-menu-item <?php echo ($action == 'inbox') ? 'mailbox-menu-current' : ''; ?>">
		      <a href="<?php echo $this->createUrl('message/inbox'); ?>">Inbox <span class="mailbox-new-msgs"><?php echo $newMsgs ? '(' . $newMsgs . ')' : null; ?></span></a>
		      </div>
		     * 
		     */ ?>
    		<a href="<?php echo $this->createUrl('message/inbox'); ?>">Inbox <span class="mailbox-new-msgs"><?php echo $newMsgs ? '(' . $newMsgs . ')' : null; ?></span></a>
    	    </li>
		<?php
	    endif;
	    if ($authSent) :
		?>
    	    <li <?php if (Yii::app()->controller->action->id == "sent") echo 'class="active"'; ?>>
		    <?php /*
		      <div  id="mailbox-sent" class="mailbox-menu-item <?php if ($action == 'sent') echo 'mailbox-menu-current '; ?>">
		      <a href="<?php echo $this->createUrl('message/sent'); ?>">Sent Mail</a>
		      </div>
		     * 
		     */ ?>
    		<a href="<?php echo $this->createUrl('message/sent'); ?>">Sent Mail</a>
    	    </li>
		<?php
	    endif;
	    if ($authTrash) :
		?>
    	    <li <?php if (Yii::app()->controller->action->id == "trash") echo 'class="active"'; ?>>
		    <?php /*
		      <div id="mailbox-trash" class="mailbox-menu-item <?php if ($action == 'trash') echo 'mailbox-menu-current '; ?>">
		      <a href="<?php echo $this->createUrl('message/trash'); ?>">Trash </a>
		      </div>
		     * 
		     */ ?>
    		<a href="<?php echo $this->createUrl('message/trash'); ?>">Trash </a> 
    	    </li>
		<?php
	    endif;
	    ?>
	    <?php /*
	      <div id="mailbox-trash" class="mailbox-menu-item <?php if ($action == 'trash') echo 'mailbox-menu-current '; ?>">
	      <a href="<?php echo $this->createUrl('message/block_user'); ?>">Block user </a>
	      </div>
	     * 
	     */ ?>
	    <?php
//</div>
	    ?>
	</ul>
    </div>


</div>